

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>纠删码配置 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Jerasure 纠删码插件" href="../erasure-code-jerasure/" />
    <link rel="prev" title="纠删码" href="../erasure-code/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">Ceph 存储集群</a></li>
          <li class="breadcrumb-item"><a href="../">集群运维</a></li>
          <li class="breadcrumb-item"><a href="../erasure-code/">纠删码</a></li>
      <li class="breadcrumb-item active">纠删码配置</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/rados/operations/erasure-code-profile.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../configuration/">配置</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">运维</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../operating/">操纵集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-checks/">健康检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">监控集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring-osd-pg/">监控 OSD 和归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../user-management/">用户管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pgcalc/">PG Calc</a></li>
<li class="toctree-l3"><a class="reference internal" href="../data-placement/">数据归置概览</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pools/">存储池</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../erasure-code/">纠删码</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id2">创建纠删码存储池样板</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id3">纠删码配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id4">在纠删码存储池上启用重写功能</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#erasure-coded-pool-overhead">Erasure-coded pool overhead</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id6">纠删码存储池与缓存分级</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id9">纠删码存储池的恢复</a></li>
<li class="toctree-l4"><a class="reference internal" href="../erasure-code/#id10">术语</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../erasure-code/#id11">内容列表</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../cache-tiering/">分级缓存</a></li>
<li class="toctree-l3"><a class="reference internal" href="../placement-groups/">归置组</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upmap/">使用 pg-upmap</a></li>
<li class="toctree-l3"><a class="reference internal" href="../read-balancer/">Operating the Read (Primary) Balancer</a></li>
<li class="toctree-l3"><a class="reference internal" href="../balancer/">均衡器模块</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map/">CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crush-map-edits/">手动编辑一个 CRUSH 图</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stretch-mode/">Stretch Clusters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../change-mon-elections/">Configuring Monitor Election Strategies</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-osds/">增加/删除 OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-or-rm-mons/">增加/删除监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../devices/">设备管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-migration/">迁移到 BlueStore</a></li>
<li class="toctree-l3"><a class="reference internal" href="../control/">命令参考</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/community/">Ceph 社区</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-mon/">监视器故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-osd/">OSD 故障排除</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/troubleshooting-pg/">归置组排障</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/log-and-debug/">日志记录和调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/cpu-profiling/">CPU 剖析</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../troubleshooting/memory-profiling/">内存剖析</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="erasure-code-profiles">
<span id="id1"></span><h1>纠删码配置<a class="headerlink" href="#erasure-code-profiles" title="Permalink to this heading"></a></h1>
<p>纠删码由<strong>配置</strong>定义，在创建纠删码存储池及其相关的 CRUSH 规则时用到。</p>
<p>名为 <strong>default</strong> 的纠删码配置（ Ceph 集群初始化时创建的）
会把数据等分为 2 块、还有两个相同尺寸的奇偶校验块。
它在集群内占用的空间和 2 副本存储池一样，
却能容许 4 个数据块丢 2 块。
这样的配置就是 <strong>k=2</strong> 且 <strong>m=4</strong> ，
意思是信息分布在四个 OSD （ k+m=4 ）且容许其中两个丢失。</p>
<p>为了在不增加原始存储空间需求的前提下提升冗余性，
你可以新建配置。例如，一个 <strong>k=10</strong> 且
<strong>m=4</strong> 的配置可容忍 4 个 OSD 失效，
它会把一对象分布到 14 个（ k+m=14 ） OSD 上。
此对象先被分割为 <strong>10</strong> 块（若对象为 10MB ，那每块就是 1MB ）、
并计算出 <strong>4</strong> 个用于恢复的编码块
（各编码块尺寸等于数据块，即 1MB ）；
这样，原始空间仅多占用 10% 就可容许 4 个 OSD 同时失效、
且不丢失数据。</p>
<div class="toctree-wrapper compound" id="id2">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../erasure-code-jerasure/">Jerasure 纠删码插件</a></li>
<li class="toctree-l1"><a class="reference internal" href="../erasure-code-isa/">ISA 纠删码插件</a></li>
<li class="toctree-l1"><a class="reference internal" href="../erasure-code-lrc/">局部自修复纠删码插件</a></li>
<li class="toctree-l1"><a class="reference internal" href="../erasure-code-shec/">SHEC 纠删码插件</a></li>
<li class="toctree-l1"><a class="reference internal" href="../erasure-code-clay/">CLAY 码插件</a></li>
</ul>
</div>
<section id="osd-erasure-code-profile-set">
<h2>osd erasure-code-profile set<a class="headerlink" href="#osd-erasure-code-profile-set" title="Permalink to this heading"></a></h2>
<p>要新建纠删码配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">erasure</span><span class="o">-</span><span class="n">code</span><span class="o">-</span><span class="n">profile</span> <span class="nb">set</span> <span class="p">{</span><span class="n">name</span><span class="p">}</span> \
     <span class="p">[{</span><span class="n">directory</span><span class="o">=</span><span class="n">directory</span><span class="p">}]</span> \
     <span class="p">[{</span><span class="n">plugin</span><span class="o">=</span><span class="n">plugin</span><span class="p">}]</span> \
     <span class="p">[{</span><span class="n">stripe_unit</span><span class="o">=</span><span class="n">stripe_unit</span><span class="p">}]</span> \
     <span class="p">[{</span><span class="n">key</span><span class="o">=</span><span class="n">value</span><span class="p">}</span> <span class="o">...</span><span class="p">]</span> \
     <span class="p">[</span><span class="o">--</span><span class="n">force</span><span class="p">]</span>
</pre></div>
</div>
<p>其中：</p>
<p><code class="docutils literal notranslate"><span class="pre">{directory=directory}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>设置纠删码插件的路径，需是<strong>目录</strong>。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No.</p>
</dd>
<dt class="field-even">默认值<span class="colon">:</span></dt>
<dd class="field-even"><p>/usr/lib/ceph/erasure-code</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">{plugin=plugin}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>指定纠删码<strong>插件</strong>来计算编码块、及恢复丢失块。
详见 <a class="reference internal" href="#id2">可用插件列表</a>。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No.</p>
</dd>
<dt class="field-even">默认值<span class="colon">:</span></dt>
<dd class="field-even"><p>jerasure</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">{stripe_unit=stripe_unit}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>每一个条带中、一个数据块的数据量。例如，
在一个配置中，数据块为 2 且 stripe_unit=4K ，
数据进来时会把 0-4K 放入块 0 ，
4K-8K 放入块 1 ；然后 8K-12K 又是块 0 。
为实现最佳性能，这里应该设置成 4K 的倍数。
默认值是在存储池创建时从监视器配置选项
<code class="docutils literal notranslate"><span class="pre">osd_pool_erasure_code_stripe_unit</span></code> 获取的。
一个使用着这个配置的存储池，
其 stripe_width 值（条带宽度）就是数据块的数量乘以这里的 stripe_unit 值。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No.</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">{key=value}</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>纠删码插件所定义的键/值对含义。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No.</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">--force</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">描述<span class="colon">:</span></dt>
<dd class="field-odd"><p>覆盖同名配置，
还能设置没有按 4K 对齐的 stripe_unit 。</p>
</dd>
<dt class="field-even">类型<span class="colon">:</span></dt>
<dd class="field-even"><p>String</p>
</dd>
<dt class="field-odd">是否必需<span class="colon">:</span></dt>
<dd class="field-odd"><p>No.</p>
</dd>
</dl>
</section>
<section id="osd-erasure-code-profile-rm">
<h2>osd erasure-code-profile rm<a class="headerlink" href="#osd-erasure-code-profile-rm" title="Permalink to this heading"></a></h2>
<p>要删除纠删码配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">erasure</span><span class="o">-</span><span class="n">code</span><span class="o">-</span><span class="n">profile</span> <span class="n">rm</span> <span class="p">{</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>若此配置还被某个存储池使用着，则删除会失败。</p>
</section>
<section id="osd-erasure-code-profile-get">
<h2>osd erasure-code-profile get<a class="headerlink" href="#osd-erasure-code-profile-get" title="Permalink to this heading"></a></h2>
<p>要查看一纠删码配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">erasure</span><span class="o">-</span><span class="n">code</span><span class="o">-</span><span class="n">profile</span> <span class="n">get</span> <span class="p">{</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="osd-erasure-code-profile-ls">
<h2>osd erasure-code-profile ls<a class="headerlink" href="#osd-erasure-code-profile-ls" title="Permalink to this heading"></a></h2>
<p>列出所有纠删码配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">osd</span> <span class="n">erasure</span><span class="o">-</span><span class="n">code</span><span class="o">-</span><span class="n">profile</span> <span class="n">ls</span>
</pre></div>
</div>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../erasure-code/" class="btn btn-neutral float-left" title="纠删码" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../erasure-code-jerasure/" class="btn btn-neutral float-right" title="Jerasure 纠删码插件" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>